//
//  BLHotelHomeTableViewCell.m
//  blanket
//
//  Created by Mac on 2018/11/14.
//  Copyright © 2018 stoneobs@icloud.com. All rights reserved.
//

#import "BLHotleRoomTableViewCell.h"

@interface  BLHotleRoomTableViewCell()
@property(nonatomic, strong) STLabel                     *nameLable;/**<  */
@property(nonatomic, strong) STButton                    *addButton;/**<  */
@property(nonatomic, strong) STLabel                     *desLable;/**<  */
@property(nonatomic, strong) STLabel                     *priceLable;/**<  */
@end
@implementation BLHotleRoomTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 90;
}
#pragma mark --subView
- (void)configSubView{

    
    ({
        STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(15, 10, UIScreenWidth - 30, 20)
                                                         text:@"希尔顿大酒店"
                                                    textColor:FirstTextColor
                                                         font:16
                                                  isSizetoFit:NO
                                                textAlignment:NSTextAlignmentLeft];
        self.nameLable = titleLable;
        [self addSubview:titleLable];
    });
    self.addButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 46, 30)
                                               title:@"预定"
                                          titleColor:UIColor.whiteColor
                                           titleFont:14
                                        cornerRadius:4
                                     backgroundColor:BL_BlueBackGroundColor
                                     backgroundImage:nil
                                               image:nil];
    self.addButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self addSubview:self.addButton];
    self.addButton.centerY = self.class.cellHeight/2;
    self.addButton.right = UIScreenWidth - 15;
    self.addButton.userInteractionEnabled = NO;
    
    ({
        STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(15, 10, UIScreenWidth - 30, 20)
                                                         text:@"希尔顿大酒店"
                                                    textColor:SecendTextColor
                                                         font:14
                                                  isSizetoFit:NO
                                                textAlignment:NSTextAlignmentLeft];
        self.desLable = titleLable;
        self.desLable.centerY = self.class.cellHeight/2;
        [self addSubview:titleLable];
    });
    
    
    ({
        STLabel * titleLable = [[STLabel alloc] initWithFrame:CGRectMake(15, 10, UIScreenWidth - 30, 20)
                                                         text:@"希尔顿大酒店"
                                                    textColor:SecendTextColor
                                                         font:13
                                                  isSizetoFit:NO
                                                textAlignment:NSTextAlignmentLeft];
        self.priceLable = titleLable;
        self.priceLable.bottom = self.class.cellHeight-10;
        [self addSubview:titleLable];
    });
}
- (void)setModel:(BLRoomModel *)model{
    self.nameLable.text = model.room_name;
    self.desLable.text = [NSString stringWithFormat:@"房间介绍:%@",model.brief];
    self.priceLable.text = [NSString stringWithFormat:@"还剩%@间          ￥%@起",model.num,model.price];
    self.priceLable.attributedText = [self.priceLable.text st_convertAttributeStringWithKeyWords:@[model.num,[NSString stringWithFormat:@"￥%@",model.price]] attributes:@[@{NSForegroundColorAttributeName:FlatBlue},@{NSForegroundColorAttributeName:FlatRed}]];
}
@end
